/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Windows Forms Controls Class Library
 * Version 2.00
 * 
 * SQL Server Login Common Dialog Class
 *		Provides a common dialog definition for logging in / connecting to SQL Server.
 *------------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------------*/
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;

using Adaptive.Foundation;
using Adaptive.Foundation.Collections;

namespace Adaptive.Foundation.Windows.Forms
{
    /// <summary>
    /// Provides a common dialog definition for logging in / connecting to SQL Server.
    /// </summary>
    public partial class SQLServerLoginDialog : ModalDialogBase
    {
        /*--------------------------------------------------------------------------------------
         * Private Member Declarations
         *------------------------------------------------------------------------------------*/
        #region Private Member Declarations
        /// <summary>
        /// Background thread for loading SQL instance names.
        /// </summary>
        private Thread _backgroundThread;
        /// <summary>
        /// SQL Server list.
        /// </summary>
        private StringCollection _sqlServerList;
        #endregion

        /*--------------------------------------------------------------------------------------
         * 
         *------------------------------------------------------------------------------------*/
        #region
        #endregion

        /*--------------------------------------------------------------------------------------
         * 
         *------------------------------------------------------------------------------------*/
        #region
        #endregion

        /*--------------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods

        /// <summary>
        /// Initializes a new instance of the class
        /// </summary>
        public SQLServerLoginDialog()
        {
            InitializeComponent();
        }
        #endregion

        /*--------------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------------*/
        #region Public Properties
        #endregion

        /*--------------------------------------------------------------------------------------
         * Protected Method Overrides
         *------------------------------------------------------------------------------------*/
        #region Protected Method Overrides
        /// <summary>
        /// Creates and assigns the event handlers for the controls on the dialog.
        /// </summary>
        protected override void AssignEventHandlers()
        {
            base.AssignEventHandlers();
        }
        /// <summary>
        /// Removes the event handlers for the controls on the dialog.
        /// </summary>
        protected override void RemoveEventHandlers()
        {
            base.RemoveEventHandlers();
        }
        /// <summary>
        /// Sets the initial content of the dialog.
        /// </summary>
        protected override void SetInitialContent()
        {
            
        }
        /// <summary>
        /// Adjusts the current display status of the controls on the dialog.
        /// </summary>
        protected override void SetFormDisplay()
        {
        }
        /// <summary>
        /// Launches the background processing threads for the dialog.
        /// </summary>
        protected override void StartFormThreads()
        {
            _backgroundThread = new Thread(new ThreadStart(LoadSqlServerInstances));
            _backgroundThread.IsBackground = true;
            _backgroundThread.Start();
        }
        /// <summary>
        /// Terminates the background processing threads for the dialog.
        /// </summary>
        protected override void TerminateFormThreads()
        {
            if (_backgroundThread != null)
            {
                try
                {
                    _backgroundThread.Abort();
                }
                catch
                {
                }
            }
            _backgroundThread = null;
        }
        #endregion


        /*--------------------------------------------------------------------------------------
         * 
         *------------------------------------------------------------------------------------*/
        #region
        #endregion


        /*--------------------------------------------------------------------------------------
         * Private Methods / Functions
         *------------------------------------------------------------------------------------*/
        #region Private Methods / Functions
        /// <summary>
        /// Queries the system for SQL Server instances.
        /// </summary>
        private void LoadSqlServerInstances()
        {
            _sqlServerList = new StringCollection();

        }
        #endregion

    }
}